package com.starlink.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.starlink.model.domain.MallBooksRasDO;
import com.starlink.model.request.MallBooksRasRequest;
import com.starlink.model.vo.MallBooksRasVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhanghong
 */
@Repository
public interface MallBooksRasMapper extends BaseMapper<MallBooksRasDO> {
    MallBooksRasDO selectDOById(Long id);
    List<MallBooksRasDO> selectDOList(MallBooksRasDO mallBooksRas);
    int insertDO(MallBooksRasDO mallBooksRas);
    int batchInsertDO(List<MallBooksRasDO> mallBooksRasDOList);
    int updateDO(MallBooksRasDO mallBooksRas);
    int deleteDOById(Long id);
    int deleteDOByIds(String[] ids);

    @Select({"<script>",
            "   select count(1) from mall_books_ras",
            "   <where>",
            "       deleted=0",
            "       <if test=\"1==0\">and id=#{param.id}</if>",
            "   </where>",
            "</script>"})
    long pageCount(@Param("param") MallBooksRasRequest param);

    List<MallBooksRasVO> pageQuery(@Param("param") MallBooksRasRequest param);
}
